package com.hljx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hljx.config.Result;
import com.hljx.dto.DateDTO;
import com.hljx.dto.SysDictDTO;
import com.hljx.dto.SysDictPageDTO;
import com.hljx.entity.SysItemPiont;
import com.hljx.service.SysDictService;
import com.hljx.service.SysItemPiontService;
import com.hljx.vo.SysDictVO;
import com.hljx.vo.SysItemPiontVO;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 科室项目对照关系表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2024-01-12
 */
@RestController
@RequestMapping("/sysItemPiont")
public class SysItemPiontController {
    @Autowired
   private SysItemPiontService sysItemPiontService;

    @Operation(summary = "科室统计项目对照-新增或编辑")
    @PostMapping("/saveOrUpdateSysItemPiont")
    public Result<Boolean> saveOrUpdateSysItemPiont(@RequestBody  SysItemPiont SysItemPiont) {
        return Result.success(sysItemPiontService.saveOrUpdateSysItemPiont(SysItemPiont));
    }

    @Operation(summary = "科室统计项目对照-删除")
    @GetMapping("/deleteSysItemPiont")
    public Result<Boolean> deleteSysItemPiont(@RequestParam("id") Long id) {
        return Result.success(sysItemPiontService.removeById(id));
    }


    @Operation(summary = "科室统计项目是否计入")
    @GetMapping("/isOffsetting")
    public Result<Boolean> isOffsetting(@RequestParam("id") Long id,
                                        @RequestParam("isOffsetting")  int isOffsetting) {
        return Result.success(sysItemPiontService.isOffsetting(id,isOffsetting));
    }




    @Operation(summary = "科室统计项目对照-分页查询")
    @PostMapping("/listByPeriod")
    public Result<IPage<SysItemPiontVO>> listByPeriod(@RequestBody DateDTO dateDTO) {
        return Result.success(sysItemPiontService.listByPeriod(dateDTO));
    }
}
